<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>53数组去重若干方法2</title>
</head>
<body>

<script>
  let arr = [1, 2, 3, 4, 44, 42, 21, 3, 3, 2, 4, 5, 5, 3, 2, 2]

  function uniqueArr(array) {
    let _arr = []
    array.forEach(function (item) {
      if (_arr.indexOf(item) === -1) {
        _arr.push(item)
      }
    })
    return _arr
  }
  let newArr = uniqueArr(arr).sort(function (a, b) {
    return a - b
  });

  console.log(newArr);


</script>
</body>
</html>